package jjoms.model.board;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

@Service
public class BoardServiceImpl implements BoardService {
@Resource(name="boardDAOImpl")
private BoardDAO boardDAO;
@Override
	public void register(BoardVO bvo) {
		if(bvo.getMemberPoint()==-1){
			boardDAO.managerRegister(bvo);
		}else{
			boardDAO.register(bvo);
		}
	}
@Override
	public BoardVO showcontent(int no) {
		System.out.println("showcontent no : "+ no);
	boardDAO.updateCount(no);
	return boardDAO.showcontent(no);
	}
@Override
	public ListVO getboardlist(String pageNo) {
	if(pageNo==null||pageNo=="") 
		pageNo="1";
	List<BoardVO> list=boardDAO.getboardlist(pageNo);
	int total=boardDAO.totalContent();
	PagingBean paging=new PagingBean(total,Integer.parseInt(pageNo));
	ListVO lvo=new ListVO(list,paging);
	return lvo;
		
	}
@Override
	public void update(BoardVO vo) {
	boardDAO.update(vo);
	}
@Override
	public void delete(int no) {
	boardDAO.delete(no);
	}
@Override
	public void coment(ComentVO cvo) {
	boardDAO.coment(cvo);
	}
@Override
	public List<ComentVO> comentview(int no) {
	return boardDAO.comentview(no);
	}
@Override
public int getComentCount(int boardNO) {
	return boardDAO.getComentCount(boardNO);
}
@Override
public void noCountComent(ComentVO cvo) {
	boardDAO.noCountComent(cvo);
}
@Override
	public BoardVO showCountNoHit(int no) {
	return boardDAO.showcontent(no);
	}
}
